#include "verify.h"
#include "ui_verify.h"

#include <QDebug>
#include <QTimer>


Verify::Verify(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Verify)
{
    ui->setupUi(this);

    this->setWindowModality(Qt::WindowModal);

}

Verify::~Verify()
{
    delete ui;
}

void Verify::on_Sdr_Verify_sliderMoved(int position)
{
    QRect rec = ui->Sdr_Verify->geometry();
    QRect rec2 = ui->lbl_yz2->geometry();
    ui->lbl_yz2->setGeometry(rec.x()+position*4,rec2.y(),rec2.width(),rec2.height());

}


void Verify::on_Sdr_Verify_sliderReleased()
{
    if(ui->Sdr_Verify->value()==61||ui->Sdr_Verify->value()==62||ui->Sdr_Verify->value()==63||ui->Sdr_Verify->value()==64)
    {
        ui->Sdr_Verify->setStyleSheet("QSlider::sub-page:horizontal {background: rgb(85,170,0);}");
        isVerified = true;
        ui->lbl_Verify->setText("验证完成");
        QTimer* timer = new QTimer;
        connect(timer,&QTimer::timeout, this, &Verify::close);
        timer->setSingleShot(true);
        timer->start(1000);
    }
    else
    {
        ui->Sdr_Verify->setValue(0);
        QRect rec = ui->Sdr_Verify->geometry();
        QRect rec2 = ui->lbl_yz2->geometry();
        ui->lbl_yz2->setGeometry(rec.x(),rec2.y(),rec2.width(),rec2.height());

    }
}

bool Verify::getIsVerified() const
{
    return isVerified;
}

